<?php

namespace addons\tvsd;

use app\common\library\Menu;
use think\Addons;

/**
 * 插件
 */
class Tvsd extends Addons
{
  protected $menu = [
    [
      'name' => 'tvsd',
      'title' => '旅游车辆调度管理',
      'icon' => 'fa fa-list',
      'ismenu' => 1,
      'py' => 'clddgl',
      'pinyin' => 'cheliangdiaoduguanli',
      'sublist' =>
      [
        [
          'name' => 'tvsd/cd',
          'title' => '车队管理',
          'icon' => 'fa fa-life-buoy',
          'ismenu' => 1,
          'py' => 'cdgl',
          'pinyin' => 'cheduiguanli',
          'weigh' => 10,
          'sublist' =>
          [
            ['name' => 'tvsd/cd/index', 'title' => '查看',],
            ['name' => 'tvsd/cd/recyclebin', 'title' => '回收站',],
            ['name' => 'tvsd/cd/add', 'title' => '添加',],
            ['name' => 'tvsd/cd/edit', 'title' => '编辑',],
            ['name' => 'tvsd/cd/del', 'title' => '删除',],
            ['name' => 'tvsd/cd/destroy', 'title' => '真实删除',],
            ['name' => 'tvsd/cd/restore', 'title' => '还原',],
            ['name' => 'tvsd/cd/multi', 'title' => '批量更新',],
          ],
        ],
        [
          'name' => 'tvsd/cl',
          'title' => '车辆管理',
          'icon' => 'fa fa-automobile',
          'ismenu' => 1,
          'py' => 'clgl',
          'pinyin' => 'cheliangguanli',
          'weigh' => 9,
          'sublist' =>
          [
            ['name' => 'tvsd/cl/index', 'title' => '查看',],
            ['name' => 'tvsd/cl/recyclebin', 'title' => '回收站',],
            ['name' => 'tvsd/cl/add', 'title' => '添加',],
            ['name' => 'tvsd/cl/edit', 'title' => '编辑',],
            ['name' => 'tvsd/cl/del', 'title' => '删除',],
            ['name' => 'tvsd/cl/destroy', 'title' => '真实删除',],
            ['name' => 'tvsd/cl/restore', 'title' => '还原',],
            ['name' => 'tvsd/cl/multi', 'title' => '批量更新',],
          ],
        ],
        [
          'name' => 'tvsd/jsy',
          'title' => '驾驶员信息',
          'icon' => 'fa fa-user-circle-o',
          'ismenu' => 1,
          'py' => 'jsyxx',
          'pinyin' => 'jiashiyuanxinxi',
          'weigh' => 8,
          'sublist' =>
          [
            ['name' => 'tvsd/jsy/index', 'title' => '查看',],
            ['name' => 'tvsd/jsy/recyclebin', 'title' => '回收站',],
            ['name' => 'tvsd/jsy/add', 'title' => '添加',],
            ['name' => 'tvsd/jsy/edit', 'title' => '编辑',],
            ['name' => 'tvsd/jsy/del', 'title' => '删除',],
            ['name' => 'tvsd/jsy/destroy', 'title' => '真实删除',],
            ['name' => 'tvsd/jsy/restore', 'title' => '还原',],
            ['name' => 'tvsd/jsy/multi', 'title' => '批量更新',],
          ],
        ],
        [
          'name' => 'tvsd/kh',
          'title' => '用车单位管理',
          'icon' => 'fa fa-address-card-o',
          'ismenu' => 1,
          'py' => 'ycdwgl',
          'pinyin' => 'yongchedanweiguanli',
          'weigh' =>7,
          'sublist' =>
          [
            ['name' => 'tvsd/kh/index', 'title' => '查看',],
            ['name' => 'tvsd/kh/recyclebin', 'title' => '回收站',],
            ['name' => 'tvsd/kh/add', 'title' => '添加',],
            ['name' => 'tvsd/kh/edit', 'title' => '编辑',],
            ['name' => 'tvsd/kh/del', 'title' => '删除',],
            ['name' => 'tvsd/kh/destroy', 'title' => '真实删除',],
            ['name' => 'tvsd/kh/restore', 'title' => '还原',],
            ['name' => 'tvsd/kh/multi', 'title' => '批量更新',],
          ],
        ],
        [
          'name' => 'tvsd/pc',
          'title' => '调度派车管理',
          'icon' => 'fa fa-table',
          'ismenu' => 1,
          'py' => 'ddpcgl',
          'pinyin' => 'diaodupaicheguanli',
          'weigh' =>6,
          'sublist' =>
          [
            ['name' => 'tvsd/pc/index', 'title' => '查看',],
            ['name' => 'tvsd/pc/recyclebin', 'title' => '回收站',],
            ['name' => 'tvsd/pc/add', 'title' => '添加',],
            ['name' => 'tvsd/pc/edit', 'title' => '编辑',],
            ['name' => 'tvsd/pc/del', 'title' => '删除',],
            ['name' => 'tvsd/pc/destroy',  'title' => '真实删除',],
            ['name' => 'tvsd/pc/restore', 'title' => '还原',],
            ['name' => 'tvsd/pc/multi', 'title' => '批量更新',],
            ['name' => 'tvsd/pc/dy', 'title' => '打印',],
            ['name' => 'tvsd/pc/cjedit', 'title' => '超级编辑',],
            ['name' => 'tvsd/pc/pcjl', 'title' => '按月派车记录',],
            ['name' => 'tvsd/pc/jrpc', 'title' => '今日派车记录',],
          ],
        ],
        [
          'name' => 'tvsd/bx',
          'title' => '报销单管理',
          'icon' => 'fa fa-print',
          'ismenu' => 1,
          'py' => 'bxdgl',
          'pinyin' => 'baoxiaodanguanli',
          'weigh' => 5,
          'sublist' =>
          [
            ['name' => 'tvsd/bx/index', 'title' => '查看',],
            ['name' => 'tvsd/bx/recyclebin', 'title' => '回收站',],
            ['name' => 'tvsd/bx/add', 'title' => '添加',],
            ['name' => 'tvsd/bx/edit', 'title' => '编辑',],
            ['name' => 'tvsd/bx/del', 'title' => '删除',],
            ['name' => 'tvsd/bx/destroy', 'title' => '真实删除',],
            ['name' => 'tvsd/bx/restore', 'title' => '还原',],
            ['name' => 'tvsd/bx/multi', 'title' => '批量更新',],
            ['name' => 'tvsd/bx/dy', 'title' => '打印',],
            ['name' => 'tvsd/bx/sh', 'title' => '审核',],
            ['name' => 'tvsd/bx/fsh', 'title' => '反审核',],
          ],
        ], [
          'name' => 'tvsd/jy',
          'title' => '车辆加油管理',
          'icon' => 'fa fa-circle-o ',
          'ismenu' => 1,
          'py' => 'cljygl',
          'pinyin' => 'cheliangjiayouguanli',
          'weigh' => 4,
          'sublist' =>
          [
            ['name' => 'tvsd/jy/index', 'title' => '查看',],
            ['name' => 'tvsd/jy/recyclebin', 'title' => '回收站',],
            ['name' => 'tvsd/jy/add', 'title' => '添加',],
            ['name' => 'tvsd/jy/edit', 'title' => '编辑',],
            ['name' => 'tvsd/jy/del', 'title' => '删除',],
            ['name' => 'tvsd/jy/destroy', 'title' => '真实删除',],
            ['name' => 'tvsd/jy/restore', 'title' => '还原',],
            ['name' => 'tvsd/jy/multi', 'title' => '批量更新',],
          ],
        ],
      ],
    ],
  ];

  /**
   * 插件安装方法
   * @return bool
   */
  public function install()
  {

    Menu::create($this->menu);
    return true;
  }

  /**
   * 插件卸载方法
   * @return bool
   */
  public function uninstall()
  {
    Menu::delete('tvsd');
    return true;
  }

  /**
   * 插件启用方法
   * @return bool
   */
  public function enable()
  {
    Menu::enable('tvsd');
    return true;
  }

  /**
   * 插件禁用方法
   * @return bool
   */
  public function disable()
  {
    Menu::disable('tvsd');
    return true;
  }


  /**
   * 插件升级方法
   * @return bool
   */
  public function upgrade()
  {
    //如果菜单有变更则升级菜单
    Menu::upgrade('tvsd', $this->menu);
    return true;
  }
}
